# -*- coding: utf-8 -*-
from bottle import route,run,response,request
from urllib2 import quote,unquote


@route('/')
def index():
    response.set_cookie('name','dingjx')
    response.set_cookie('myname',quote('ss'))
    return 'Bottle Set Cookie!'

@route('/getcookie')
def getcookie():
    return unquote(request.get_cookie('myname'))

@route('/setsign')
def setsign():
    response.set_cookie('sname','dingjx',secret="jdhdhdd^%$###3")
    return "Bottle Set Signed Cookie!"

@route('/getsign')
def getsign():
    return request.get_cookie('sname',secret="jdhdhdd^%$###3")

@route('/setzhcookie')
def setzh():
    response.set_cookie('yourname','ss',secret="jdhdhdd^%$###3")
    return "Bottle Set Signed zh Cookie!"

@route('/getzhcookie')
def getzh():
    return request.get_cookie('yourname',secret="jdhdhdd^%$###3")

run(host="localhost",port='80',debug=True,reloader=True)